import {
  getAddress, getDormitory
} from '@/api/basic'
import {
  dormitory
} from '@/api/dorm'
const identity_card = {
  folder: 'oa/admin',
  type: 'idcard',
  analysis: 1
}
export const disabled = false
export const disabledT = true
export const title = {
  name: {
    form: 'input',
    label: '(必填)姓名',
    placeholder: '请输入姓名',
    disabled: disabled,
    type: 'text'
  },
  phone: {
    maxlength: 11,
    form: 'input',
    label: '(必填)手机',
    placeholder: '请输入手机号',
    disabled: disabled,
    type: 'text'
  },
  password: {
    form: 'input',
    label: '(必填)密码',
    placeholder: '请输入员工登入默认密码',
    disabled: disabled,
    type: 'password'
  },
  family_phone: {
    maxlength: 11,
    form: 'input',
    label: '家庭电话',
    placeholder: '请输入家庭电话',
    disabled: disabled,
    type: 'text'
  },
  age: {
    form: 'input',
    label: '年龄',
    placeholder: '请输入年龄',
    disabled: disabledT,
    type: 'number'
  },
  present_address: {
    form: 'input',
    label: '现住地址',
    placeholder: '请输入现住地址(精确到门牌号)',
    disabled: disabled,
    type: 'text'
  },
  email: {
    form: 'input',
    label: '邮箱',
    placeholder: '请输入邮箱号',
    disabled: disabled,
    type: 'email'
  },
  computer_power: {
    form: 'input',
    label: '电脑能力',
    placeholder: '请输入电脑能力',
    disabled: disabled,
    type: 'text'
  },
  hobby: {
    form: 'input',
    label: '爱好特长',
    placeholder: '请输入爱好特长',
    disabled: disabled,
    type: 'text'
  },
  identity_card: {
    form: 'input',
    label: '身份证号',
    placeholder: '上传身份证后自动识别',
    disabled: disabledT,
    type: 'text'
  },
  height: {
    form: 'input',
    label: '身高(CM)',
    placeholder: '请输入身高',
    disabled: disabled,
    type: 'number'
  },
  weight: {
    form: 'input',
    label: '体重(KG)',
    placeholder: '请输入体重',
    disabled: disabled,
    type: 'number'
  },
  major: {
    form: 'input',
    label: '所学专业',
    placeholder: '请输入所学专业',
    disabled: disabled,
    type: 'text'
  },
  speciality: {
    form: 'input',
    label: '特长',
    placeholder: '请输入特长',
    disabled: disabled,
    type: 'text'
  },
  bank_card: {
    form: 'input',
    label: '银行卡号',
    placeholder: '请输入银行卡号',
    disabled: disabled,
    type: 'text'
  },
  social_insurance: {
    form: 'input',
    label: '社保编号',
    placeholder: '请输入社保编号',
    disabled: disabled,
    type: 'text'
  },
  no: {
    form: 'input',
    label: '工号',
    placeholder: '请输入工号',
    disabled: disabled,
    type: 'text'
  },
  practice_salary: {
    form: 'input',
    label: '实习薪资',
    placeholder: '请输入实习薪资',
    disabled: disabled,
    type: 'number'
  },
  regular_salary: {
    form: 'input',
    label: '转正薪资',
    placeholder: '请输入转正薪资',
    disabled: disabled,
    type: 'number'
  },
  current_salary: {
    form: 'input',
    label: '当前薪资',
    placeholder: '请输入当前薪资',
    disabled: disabled,
    type: 'number'
  },
  entry_mode: {
    form: 'input',
    label: '入职方式',
    placeholder: '请输入入职方式',
    disabled: disabled,
    type: 'text'
  },
  one_inch_photo: {
    form: 'img',
    label: '一寸照',
    disabled: disabled,
    data: {
      folder: 'oa/admin'
    }
  },
  identity_card_front: {
    form: 'img',
    label: '身份证反面(人像面)',
    disabled: disabled,
    data: {
      ...identity_card,
      idcardType: 'front',
      sex: 1
    }
  },
  identity_card_reverse: {
    form: 'img',
    label: '身份证正面(国徽面)',
    disabled: disabled,
    data: {
      ...identity_card,
      idcardType: 'back'
    }
  },
  resume_attachment: {
    form: 'file',
    label: '简历附件',
    disabled: disabled,
    data: {
      folder: 'oa/admin'
    }
  },
  labor_contract: {
    form: 'file',
    label: '劳动合同',
    disabled: disabled,
    data: {
      folder: 'oa/admin'
    }
  },
  physical_examination: {
    form: 'file',
    label: '体检记录电子版',
    disabled: disabled,
    data: {
      folder: 'oa/admin'
    }
  },
  temporary_residence_permit: {
    form: 'file',
    label: '暂住证电子版',
    disabled: disabled,
    data: {
      folder: 'oa/admin'
    }
  },
  labor_contract_start: {
    form: 'date',
    label: '劳动合同开始日期',
    disabled: disabled,
    show: false,
    value: ''
  },
  labor_contract_end: {
    form: 'date',
    label: '劳动合同结束日期',
    disabled: disabled,
    show: false,
    value: ''
  },
  professional_title: {
    form: 'input',
    label: '职称',
    placeholder: '请输入职称',
    disabled: disabled
  },
  present_residence: {
    form: 'input',
    label: '现居住地',
    placeholder: '请输入现居住地(大概位置)',
    disabled: disabled
  },
  description: {
    form: 'input',
    label: '备注',
    placeholder: '请输入备注',
    disabled: disabled
  },
  birthday_at: {
    form: 'date',
    label: '出生日期',
    disabled: disabledT,
    show: false,
    value: ''
  },
  identity_card_at: {
    form: 'date',
    label: '身份证有效期',
    disabled: disabledT,
    show: false,
    value: ''
  },
  graduation_at: {
    form: 'date',
    label: '毕业时间',
    disabled: disabled,
    show: false,
    value: ''
  },
  entry_at: {
    form: 'date',
    label: '入职日期',
    disabled: disabled,
    show: false,
    value: ''
  },
  practice_start_at: {
    form: 'date',
    label: '实习开始时间',
    disabled: disabled,
    show: false,
    value: ''
  },
  practice_end_at: {
    form: 'date',
    label: '实习结束时间',
    disabled: disabled,
    show: false,
    value: ''
  },
  regular_at: {
    form: 'date',
    label: '转正时间',
    disabled: disabled,
    show: false,
    value: ''
  },
  education_id: {
    form: 'choose',
    label: '学历',
    disabled: disabled,
    labelItem: 'name',
    placeholder: '请选择学历',
    value: 'id',
    options: [],
    remote: false
  },
  nation_id: {
    form: 'choose',
    label: '民族',
    disabled: disabled,
    placeholder: '请选择民族',
    labelItem: 'nation',
    value: 'id',
    options: [],
    remote: false
  },
  marital_id: {
    form: 'choose',
    label: '婚姻状态',
    disabled: disabled,
    placeholder: '请选择婚姻状态',
    labelItem: 'name',
    value: 'id',
    options: [],
    remote: false
  },
  politic_id: {
    form: 'choose',
    label: '政治面貌',
    disabled: disabled,
    placeholder: '请选择政治面貌',
    labelItem: 'name',
    value: 'id',
    options: [],
    remote: false
  },
  registered_residence: {
    disabled: disabled,
    form: 'check',
    label: '户口性质',
    options: [{
      id: 0,
      name: '非农业户口'
    }, {
      id: 1,
      name: '农业户口'
    }]
  },
  education_nature: {
    disabled: disabled,
    form: 'check',
    label: '学历性质',
    options: [{
      id: 0,
      name: '自考'
    }, {
      id: 1,
      name: '成人教育'
    }, {
      id: 2,
      name: '统招'
    }]
  },
  identity: {
    disabled: disabled,
    form: 'check',
    label: '员工身份',
    options: [{
      id: 0,
      name: '正式'
    }, {
      id: 1,
      name: '实习'
    }, {
      id: 2,
      name: '试用'
    }]
  },
  certificate: {
    disabled: disabled,
    form: 'check',
    label: '是否有证',
    options: [{
      id: 0,
      name: '无证'
    }, {
      id: 1,
      name: '有证'
    }]
  },
  gender: {
    disabled: disabledT,
    form: 'check',
    label: '性别',
    options: [{
      id: 0,
      name: '女'
    }, {
      id: 1,
      name: '男'
    }]
  },
  department_id: {
    form: 'chooseMany',
    label: '部门',
    disabled: disabled,
    placeholder: '请选择部门',
    options: [],
    props: {
      value: 'id',
      children: 'children',
      label: 'name',
      checkStrictly: true
    }
  },
  leader_id: {
    disabled: disabledT,
    form: 'check',
    label: '领导',
    options: [{
      id: 0,
      name: '请先选择部门'
    }]
  },
  position_id: {
    form: 'choose',
    label: '职位',
    disabled: disabled,
    placeholder: '请选择职位',
    labelItem: 'name',
    value: 'id',
    options: [],
    remote: false
  },
  // room_id: {
  //   form: 'cascader',
  //   label: '房间',
  //   disabled: disabled,
  //   placeholder: '请选择房间',
  //   labelItem: 'address',
  //   value: 'id',
  //   options: [],
  //   remote: false
  // },
  school_id: {
    form: 'choose',
    label: '毕业院校',
    disabled: disabled,
    placeholder: '请输入后选择毕业院校',
    labelItem: 'school_name',
    value: 'id',
    options: [],
    remote: true
  },
  bank_id: {
    form: 'choose',
    label: '银行',
    disabled: disabled,
    placeholder: '请输入后选择银行',
    labelItem: 'bankName',
    value: 'id',
    options: [],
    remote: true
  },
  domicile_id: {
    form: 'address',
    label: '户籍地',
    placeholder: '请选择户籍地',
    props: {
      lazy: true,
      lazyLoad(node, resolve) {
        const {
          level,
          value
        } = node
        getAddress(level == 0 ? '' : value.id).then(res => {
          console.log(res)
          const nodes = res.data.map(item => ({
            value: item,
            label: item.name,
            leaf: item.level >= 3
          }))
          resolve(nodes)
        })
      }
    }
  },
  room_id: {
    form: 'cascader',
    disabled: disabled,
    label: '房间',
    placeholder: '请选择房间号',
    options: []
  },
  emergency_contact: {
    form: 'emergency_contact',
    label: '紧急联系人',
    disabled: disabled
  },
  certificate_list: {
    form: 'certificate_list',
    label: '证书',
    disabled: disabled
  }
}
